package ma.ensias.healthme.admin;

import ma.ensias.healthme.R;
import ma.ensias.healthme.dao.PersonneDao;
import ma.ensias.healthme.entities.Personne;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Spinner;

public class AjouterCompteActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ajouter_utilisateur_form);
	}
	
	
	public void AjouterCompte(View v){
		
		String nom=((EditText)findViewById(R.id.Nom)).getText().toString();
		String prenom=((EditText)findViewById(R.id.Prenom)).getText().toString();
		Spinner mySpinner = (Spinner)findViewById(R.id.Info_Role);
		String role = mySpinner.getSelectedItem().toString();
		String email=((EditText)findViewById(R.id.Email)).getText().toString();
		String pass=((EditText)findViewById(R.id.Pass)).getText().toString();
		String login=((EditText)findViewById(R.id.Login)).getText().toString();
		Personne personne=new Personne(nom,prenom,login,pass,role);
		personne.setEmail(email);
		
		PersonneDao pDao=new PersonneDao();
		pDao.insert(personne);
		
		
	}
	
}
